﻿
using AiShow.BLL;
using AiShow.IBLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AiShow.WebSite
{
    public partial class AvatarEdit : System.Web.UI.Page
    {
        IUserManager manager = new UserManager();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAvatar_Click(object sender, EventArgs e)
        {
            if (IsValid) {
                
                var user = IdentityManager.ReadUser();
                user.Avatar = hfAvatar.Value;
                 var result=  manager.EditAvatar(user);
                if (result.StatusCode == Model.OperResult.StatusCode.Succeed)
                {
                    Response.Redirect("Personal.aspx");
                }
                else {
                    ClientScript.RegisterStartupScript(GetType(), "editerror", $"alert('{result.Message}')", true);
                }
            }
        }
    }
}